// 导入路由相关文件
import Vue from 'vue'
import Router from 'vue-router'

// 使用路由
Vue.use(Router)

// 去除重复路由报错
const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
	return originalPush.call(this, location).catch(err => err)
}
// 导入路由并进行懒加载
const S1 = () => import('../pages/S1/S1')
const S2 = () => import('../pages/S2/S2')
const S3 = () => import('../pages/S3/S3')

// 配置路由路径
const routes = [{
		path: '',
		redirect: '/S1'
	},
	{
		path: '/S1',
		component: S1,
	},
	{
		path: '/S2',
		component: S2,
	},
	{
		path: '/S3',
		component: S3
	}
]

// 创建Router的实例
const router = new Router({
	routes,
	modeL: 'history',
})

// 导出router
export default router
